//
//  AppDelegate.m
//  1yqb
//
//  Created by 曲天白 on 15/12/11.
//  Copyright © 2015年 乙科网络. All rights reserved.
//

#import "NetWorkTool.h"
@interface NetWorkTool()


@property (nonatomic, strong) AFHTTPSessionManager *httpSessionManager;

@end
@implementation NetWorkTool

//将NSDictionary中的Null类型的项目转化成@""
+(NSDictionary *)nullDic:(NSDictionary *)myDic
{
    NSArray *keyArr = [myDic allKeys];
    NSMutableDictionary *resDic = [[NSMutableDictionary alloc]init];
    for (int i = 0; i < keyArr.count; i ++)
    {
        id obj = [myDic objectForKey:keyArr[i]];
        
        obj = [self changeType:obj];
        
        [resDic setObject:obj forKey:keyArr[i]];
    }
    return resDic;
}

//将NSArray中的Null类型的项目转化成@""
+(NSArray *)nullArr:(NSArray *)myArr
{
    NSMutableArray *resArr = [[NSMutableArray alloc] init];
    for (int i = 0; i < myArr.count; i ++)
    {
        id obj = myArr[i];
        
        obj = [self changeType:obj];
        
        [resArr addObject:obj];
    }
    return resArr;
}

//将NSString类型的原路返回
+(NSString *)stringToString:(NSString *)string
{
    return string;
}

//将Null类型的项目转化成@""
+(NSString *)nullToString
{
    return @"";
}

#pragma mark - 公有方法
//类型识别:将所有的NSNull类型转化成@""
+(id)changeType:(id)myObj
{
    if ([myObj isKindOfClass:[NSDictionary class]])
    {
        return [self nullDic:myObj];
    }
    else if([myObj isKindOfClass:[NSArray class]])
    {
        return [self nullArr:myObj];
    }
    else if([myObj isKindOfClass:[NSString class]])
    {
        return [self stringToString:myObj];
    }
    else if([myObj isKindOfClass:[NSNull class]])
    {
        return [self nullToString];
    }
    else
    {
        return myObj;
    }
}
/**
 *  数组转json
 *
 *  @param arr 数组
 *
 *  @return 数组json
 */
+ (NSString *)NSArrayTojson:(NSArray *)arr{
    NSError *parseError   = nil;
    
    NSData *jsonData      = [NSJSONSerialization dataWithJSONObject:arr options:NSJSONWritingPrettyPrinted error:&parseError];
    return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
/**
 *  json 转 字典
 *
 *  @param jsonStr json
 *
 *  @return 数组
 */
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonStr{
    if (jsonStr == nil) {
        return nil;
    }
    NSData *jsonData      = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
    NSError *error;
    NSDictionary *dic     = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
    return dic;
}
/**
 * 字典转json
 */
+ (NSString*)dictionaryToJson:(NSDictionary *)dic {
    
    NSError *parseError   = nil;
    
    NSData *jsonData      = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
    
    return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    
}
/**
 *  json 转 数组
 *
 *  @param jsonStr json
 *
 *  @return 数组
 */
+(NSArray *)arrayWithjsonString:(NSString *)jsonStr{
    if (jsonStr == nil) {
        return nil;
    }
    NSData *jsonData      = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
    NSError *error;
    NSArray *arr          = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error];
    return arr;
}
/**
 *  便利加载网络图片
 *
 *  @param imagV       图片容器
 *  @param imageUrlStr 图片地址字符串
 */
+(void)imageWithImagView:(UIImageView *)imagV andImageUrlStr :(NSString *)imageUrlStr {
    
    NSString *completeUrl = [NSString stringWithFormat:@"%@%@", BaseUrl,imageUrlStr];
    NSURL *url            = [NSURL URLWithString:completeUrl];
    [imagV sd_setImageWithURL:url];
    
}
#pragma mark - AFNetworking


/**
 * 异步网络请求数据
 * @success：请求成功回调代码块
 * @fail:请求失败回调代码块
 */
+(void)asyncNetworkingUrl:(NSString *)url andDict:(id)param
                     finishBlock:(netRequestResultBlock)finishBlock{
    
    
    //请求管理者
    AFHTTPSessionManager *mgr    = [AFHTTPSessionManager manager];
   

    mgr.requestSerializer = [AFJSONRequestSerializer serializer];
    mgr.responseSerializer = [AFHTTPResponseSerializer serializer];
    
    
    mgr.operationQueue.maxConcurrentOperationCount = 4;
    mgr.completionQueue = dispatch_get_main_queue();
    [UIApplication sharedApplication].networkActivityIndicatorVisible=NO;
    
    [mgr.requestSerializer setValue:[Userdefault getUser][@"accessToken"] forHTTPHeaderField:@"token"];
  
    NSLog(@"%@",[Userdefault getUser][@"accessToken"]);
    [mgr.requestSerializer willChangeValueForKey:@"timeoutInterval"];
    mgr.requestSerializer.timeoutInterval = 30;
    [mgr.requestSerializer didChangeValueForKey:@"timeoutInterval"];
    NSString *urlStr = nil;
   
        urlStr=[NSString stringWithFormat:@"%@%@",BaseUrl,url];
//
    NSLog(@"请求的网络地址%@",urlStr);
    //发送请求
    [mgr POST:urlStr parameters:param success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        //        NSLog(@"%@",responseObject);
        //数据保护
        if (responseObject != nil) {
            NSLog(@"获取成功");
            dispatch_async(dispatch_get_main_queue(), ^{
                NSDictionary* json = [NSJSONSerialization
                                      JSONObjectWithData:[self changeType:responseObject]
                                      options:kNilOptions
                                      error:nil];
                finishBlock(json); //成功回调
            });
            
            return ;
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"获取失败");
        
        dispatch_async(dispatch_get_main_queue(), ^{
            if (finishBlock)
            {
                finishBlock(nil);
            }
        });
    }];
   
}


#pragma -mark 上传图片
+ (void)userHeadImg:(NSMutableArray *)imgArr deleteArr:(NSMutableArray *)deleteArr billId:(NSString*)billId billType:(NSString *)billType success:(void (^)(NSDictionary *responseObject))success failure:(void (^)(NSError *error))failure   uploadProgressBlock:(void(^)(float uploadPercent,long long totalBytesWritten,long long totalBytesExpectedToWrite))uploadProgressBlock{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    
    dic[@"billId"] = billId;
    dic[@"billType"] =billType;
    dic[@"deleteArray"] = deleteArr;
     [manager.requestSerializer setValue:[Userdefault getUser][@"accessToken"] forHTTPHeaderField:@"token"];
    NSString *url = [NSString stringWithFormat:@"%@%@",BaseUrl,@"app/v1/upload/file"];
    
    [manager POST:url parameters:dic constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
      
      
         int i = 0;
         //根据当前系统时间生成图片名称
         NSDate *date = [NSDate date];
         NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
         [formatter setDateFormat:@"yyyy.MM.dd.ss"];
         NSString *dateString = [formatter stringFromDate:date];
         for (UIImage *image in imgArr) {
         NSString *fileName = [NSString stringWithFormat:@"%@%d.png",dateString,i];
         NSData *imageData;
         imageData = UIImageJPEGRepresentation(image, 0.5);
         NSLog(@"图片二进制：%@",imageData);
         [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"file%d",i] fileName:fileName mimeType:@"multipart/form-data"];
         i++;
         }
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if (responseObject != nil) {
                NSLog(@"获取成功");
                dispatch_async(dispatch_get_main_queue(), ^{
                    success(responseObject); //成功回调
                });
                
                return ;
            }//成功回调
        });
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if (failure)
            {
                failure(nil);
            }
        });

    }];
        

}
#pragma -mark 团购活动列表
+(void)getTuanGouActivityDataWithPage:(NSInteger)page isSignUp:(BOOL)isSignUp finishBlock:(netRequestResultBlock)finishBlock{
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"current"] = @(page);
    if (isSignUp) {
       
        dic[@"isSignUp"] = @"Y";
    }else{
       
        dic[@"isSignUp"] = @"N";
    }
    
    [self asyncNetworkingUrl:@"api/v1/groupBuy/queryGoods" andDict:dic
                 finishBlock:finishBlock];
    /*
     int i = 0;
     //根据当前系统时间生成图片名称
     NSDate *date = [NSDate date];
     NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
     [formatter setDateFormat:@"yyyy.MM.dd.ss"];
     NSString *dateString = [formatter stringFromDate:date];
     for (UIImage *image in imgArr) {
     NSString *fileName = [NSString stringWithFormat:@"%@%d.png",dateString,i];
     NSData *imageData;
     imageData = UIImageJPEGRepresentation(image, 0.5);
     NSLog(@"图片二进制：%@",imageData);
     [formData appendPartWithFileData:imageData name:[NSString stringWithFormat:@"files%d",i] fileName:fileName mimeType:@"multipart/form-data"];
     i++;
     }
     */
    
}
#pragma -mark 检查新版本

+(void)getNewVerson:(netRequestResultBlock)finishBlock{
    NSString *urlStr = [NSString stringWithFormat:@"https://itunes.apple.com/cn/lookup?id=%@",APPID];
    //请求管理者
    AFHTTPRequestOperationManager *mgr    = [AFHTTPRequestOperationManager manager];
    //修改afn 支持新浪返回的JSON结构
    
    
    mgr.requestSerializer                 = [AFHTTPRequestSerializer serializer ];
    mgr.responseSerializer                = [AFJSONResponseSerializer serializer];
    [mgr.requestSerializer willChangeValueForKey:@"timeoutInterval"];
    mgr.requestSerializer.timeoutInterval = 12;
    [mgr.requestSerializer didChangeValueForKey:@"timeoutInterval"];
    
    
    //发送请求
    
    [mgr POST:urlStr parameters:nil success:^(AFHTTPRequestOperation *operation, NSDictionary* responseObject) {
        
        //        NSLog(@"%@",responseObject);
        //数据保护
        if (responseObject != nil) {
            NSLog(@"获取成功");
            dispatch_async(dispatch_get_main_queue(), ^{
                finishBlock([self changeType:responseObject]); //成功回调
            });
            
            return ;
        }
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"获取失败");
        
        dispatch_async(dispatch_get_main_queue(), ^{
            if (finishBlock)
            {
                finishBlock(nil);
            }
        });
        
    }];
    
}
#pragma -mark 登录
+(void)goToLoginWithLoginId:(NSString*)loginId userPwd:(NSString*)userPwd block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"loginId"] = loginId;
    dic[@"userPwd"] = userPwd;
    dic[@"imei"] = @"Imei";
    dic[@"deviceType"] = @"IOS";
    NSDictionary *infoDict = [[NSBundle mainBundle]infoDictionary];
    NSString *version = [infoDict objectForKey:@"CFBundleShortVersionString"];
    dic[@"loginVersion"] = version;

    [self asyncNetworkingUrl:@"app/v1/login/check" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 首页
+(void)getHomeData:(netRequestResultBlock)finishBlock{
   
    [self asyncNetworkingUrl:@"app/v1/index/home" andDict:nil
                 finishBlock:finishBlock];

}
#pragma -mark 病害巡查列表
+(void)getSearchForDiseaseWithPage:(NSInteger)page pageSize:(NSInteger)pageSize block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"pageSize"] = [NSString stringWithFormat:@"%ld",pageSize];
    dic[@"current"] = [NSString stringWithFormat:@"%ld",page];
    dic[@"imgs"] = @[@"1",@"2",@"3"];
    [self asyncNetworkingUrl:@"app/v1/damageInspection/GetDamageInspectionList" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害巡查详情
+ (void)getSearchForDiseaseDetailWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"diseaseInspectionId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/damageInspection/GetSingleDamageInspection" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害巡查添加
+ (void)addSearchForDiseaseblock:(netRequestResultBlock)finishBlock{
    [self asyncNetworkingUrl:@"app/v1/damageInspection/AddDamageInspection" andDict:nil
                 finishBlock:finishBlock];
}
#pragma -mark 接收部门列表
+ (void)receiveDepartmentWithUnitID:(NSString*)unitID  block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintainUnitId"] = unitID;
    [self asyncNetworkingUrl:@"app/v1/damageInspection/GetReceiveDepartment" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 接收人列表
+ (void)receiveManWithUnitID:(NSString*)unitID  block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"receiveDepartmentId"] = unitID;
    [self asyncNetworkingUrl:@"app/v1/damageInspection/GetReceiveReceiveUser" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害形式列表
+ (void)getDiseaseStyle:(NSString*)style  block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"diseaseTypeCode"] = style;
    [self asyncNetworkingUrl:@"app/v1/damageInspection/GetDiseaseFormList" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害巡查保存，上报
+ (void)putUpSearchForDisease:(NSString*)diseaseInspectionId routeId:(NSString *)routeId maintainUnitId:(NSString *)maintainUnitId receiveDepartmentId:(NSString *)receiveDepartmentId receiveUser:(NSString *)receiveUser diseaseTypeCode:(NSString *)diseaseTypeCode drivingDirectionCode:(NSString *)drivingDirectionCode startStake:(NSString *)startStake
                     endStake:(NSString *)endStake diseaseFormId:(NSString *)diseaseFormId diseaseLevelCode:(NSString *)diseaseLevelCode diseaseUnitCode:(NSString *)diseaseUnitCode lanePositionCode:(NSString *)lanePositonCode num:(NSString *)num remark:(NSString *)remark weatherCode:(NSString *)weatherCode state:(NSString *)state time:(NSString *)time inspectionUser:(NSString *)inspectionUser block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"diseaseInspectionId"] = diseaseInspectionId;
    dic[@"routeId"] =routeId;
    dic[@"maintainUnitId"] =maintainUnitId;
    dic[@"receiveDepartmentId"] = receiveDepartmentId;
    dic[@"receiveUser"] = receiveUser;
    dic[@"diseaseTypeCode"] =diseaseTypeCode;
    dic[@"drivingDirectionCode"] =drivingDirectionCode;
    dic[@"startStake"] =startStake;
    dic[@"endStake"] =endStake;
    dic[@"diseaseFormId"] =diseaseFormId;
    dic[@"diseaseLevelCode"] =diseaseLevelCode;
    dic[@"diseaseUnitCode"] =diseaseUnitCode;
    dic[@"lanePositionCode"] =lanePositonCode;
    dic[@"num"] =num;
    dic[@"remark"] =remark;
    dic[@"weatherCode"] =weatherCode;
    dic[@"vcBooleanCode"] =state;//1 上报  0 是未上报
    dic[@"inspectionDate"] = time;
    dic[@"inspectionUser"] = inspectionUser;
    [self asyncNetworkingUrl:@"app/v1/damageInspection/SaveDamageInspection" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害维修保存，上报
+ (void)putUpDiseaseMaintain:(NSString*)maintentanceRecordId maintainUnitId:(NSString *)maintainUnitId maintentanceNoticeNo:(NSString *)maintentanceNoticeNo maintenanceDepartmentId:(NSString *)maintenanceDepartmentId startDate:(NSString *)startDate endDate:(NSString *)endDate checkUser:(NSString *)checkUser directorUser:(NSString *)directorUser  remark:(NSString *)remark weather:(NSString *)weather state:(NSString *)state subProject:(NSString *)subProject measureCode:(NSString *)measureCode maxPrice:(NSString *)maxPrice unit:(NSString *)unit price:(NSString *)price num:(NSString *)num block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceRecordId"] = maintentanceRecordId;
    dic[@"maintentanceNoticeNo"] = maintentanceNoticeNo;
    dic[@"maintenanceDepartmentId"] = maintenanceDepartmentId;
    dic[@"maintainUnitId"] = maintainUnitId;
    dic[@"startDate"] = startDate;
    dic[@"endDate"] = endDate;
    dic[@"checkerUser"] = checkUser;
    dic[@"directorUser"] = directorUser;
    dic[@"remark"] = remark;
    dic[@"weather"] = weather;
    dic[@"vcBooleanCode"] =state;//1 上报  0 是未上报
    dic[@"subProjectTypeCode"] = subProject;
    dic[@"maintenanceMeasureId"] = measureCode;
    dic[@"price"] = price;
    dic[@"maxPrice"] = maxPrice;
    dic[@"measureUnitCode"] = unit;
    dic[@"actualNum"] = num;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceRecord/SaveMaintentanceRecord" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 安全检查保存，上报
+ (void)putUpSafetyCheck:(NSString*)securityCheckId isSignCorrect:(NSString *)isSignCorrect isSaftycoat:(NSString *)isSaftycoat ifSafetyProcess:(NSString *)ifSafetyProcess  isSafetyTraffic:(NSString *)isSafetyTraffic isSafeGuard:(NSString *)isSafeGuard isExistedSafetyman:(NSString *)isExistedSafetyman  otherContent:(NSString *)otherContent dealSuggestion:(NSString *)dealSuggestion content:(NSString *)content checkerUser:(NSString *)checkerUser checkerDate:(NSString *)checkerDate safetyManager:(NSString *)safetyManager signDate:(NSString *)signDate remark:(NSString *)remark routeId:(NSString *)routeId state:(NSString *)state block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"securityCheckId"] = securityCheckId;
    dic[@"isSignCorrect"] = isSignCorrect;
    dic[@"isSaftycoat"] = isSaftycoat;
    dic[@"ifSafetyProcess"] = ifSafetyProcess;
    dic[@"isSafetyTraffic"] = isSafetyTraffic;
    dic[@"isSafeGuard"] = isSafeGuard;
    dic[@"isExistedSafetyman"] = isExistedSafetyman;
    dic[@"otherContent"] = otherContent;
    dic[@"dealSuggestion"] = dealSuggestion;
    dic[@"checkerUser"] = checkerUser;
    dic[@"checkDate"] = checkerDate;
    dic[@"safetyManager"] = safetyManager;
    dic[@"signDate"] = signDate;
    dic[@"remark"] = remark;
    dic[@"routeId"] = routeId;
    dic[@"content"] = content;
    dic[@"vcBooleanCode"] =state;//1 上报  0 是未上报
    [self asyncNetworkingUrl:@"app/v1/dmSecurityCheck/SaveSecurityCheck" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害验收保存，上报
+ (void)putUpDiseaseReceive:(NSString*)maintentanceAcceptanceId maintentanceNoticeNo:(NSString *)maintentanceNoticeNo billNo:(NSString *)billNo maintainUnitId:(NSString *)maintainUnitId  maintenanceDepartmentId:(NSString *)maintenanceDepartmentId startDate:(NSString *)startDate endDate:(NSString *)endDate  directorUser:(NSString *)directorUser directorSignDate:(NSString *)directorSignDate state:(NSString *)state accepterUser:(NSString *)accepterUser accepteSignDate:(NSString *)accepteSignDate remark:(NSString *)remark routeId:(NSString *)routeId vcBooleanCode:(NSString *)vcBooleanCode maintentanceMny:(NSString*)maintentanceMny acceptanceProjectMny:(NSString*)acceptanceProjectMny block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceAcceptanceId"] = maintentanceAcceptanceId;
    dic[@"maintentanceNoticeNo"] = maintentanceNoticeNo;
    dic[@"billNo"] = billNo;
    dic[@"maintainUnitId"] = maintainUnitId;
    dic[@"maintenanceDepartmentId"] = maintenanceDepartmentId;
    dic[@"startDate"] = startDate;
    dic[@"endDate"] = endDate;
    dic[@"directorUser"] = directorUser;
    dic[@"directorSignDate"] = directorSignDate;
    dic[@"state"] = state;
    dic[@"accepterUser"] = accepterUser;
    dic[@"accepteSignDate"] = accepteSignDate;
    dic[@"remark"] = remark;
    dic[@"routeId"] = routeId;
    dic[@"vcBooleanCode"] = vcBooleanCode;//1 上报  0 是未上报
    dic[@"maintentanceMny"] = maintentanceMny;
    dic[@"acceptanceProjectMny"] = acceptanceProjectMny;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceAcceptance/SaveMaintentanceAcceptance" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害巡查草稿删除
+ (void)getSearchForDiseaseDeleteWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"diseaseInspectionId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/damageInspection/DeleteDamageInspection" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 维修通知列表
+(void)getMainTainNotificationWithPage:(NSInteger)page pageSize:(NSInteger)pageSize block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"pageSize"] = [NSString stringWithFormat:@"%ld",pageSize];
    dic[@"current"] = [NSString stringWithFormat:@"%ld",page];
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceNotice/QueryData" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 维修通知详情
+ (void)getMainTainNotificationDetailWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceNoticeId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceNotice/Detail" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 验收通知列表
+(void)getAcceptanceNotificationWithPage:(NSInteger)page pageSize:(NSInteger)pageSize block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"pageSize"] = [NSString stringWithFormat:@"%ld",pageSize];
    dic[@"current"] = [NSString stringWithFormat:@"%ld",page];
    [self asyncNetworkingUrl:@"app/v1/dmAcceptanceNotice/QueryData" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 验收通知详情
+ (void)getAcceptanceNotificationDetailWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"acceptanceNoticeId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/dmAcceptanceNotice/Detail" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害维修列表
+(void)getDiseaseMaintainWithPage:(NSInteger)page pageSize:(NSInteger)pageSize block:(netRequestResultBlock)finishBlock{

    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"pageSize"] = [NSString stringWithFormat:@"%ld",pageSize];
    dic[@"current"] = [NSString stringWithFormat:@"%ld",page];
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceRecord/QueryMaintentanceRecordPage" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害维修详情
+ (void)getDiseaseMaintainDetailWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceRecordId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceRecord/GetMaintentanceRecordDetail" andDict:dic
                 finishBlock:finishBlock];

}
#pragma -mark 病害维修上报和保存
+ (void)getDiseaseMaintainPutUpWithMaintentanceRecordId:(NSString *)maintentanceRecordId routeId:(NSString *)routeId maintainUnitId:(NSString *)maintainUnitId startDate:(NSString *)startDate endDate:(NSString *)endDate maintenanceDepartentId:(NSString *)maintenanceDepartentId remark:(NSString*)remark weatherCode:(NSString *)weatherCode state:(NSString *)state block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceRecordId"] = maintentanceRecordId;
    dic[@"routeId"] =routeId ;
    dic[@"startDate"] = startDate;
    dic[@"endDate"] = endDate;
    dic[@"maintenanceDepartentId"] = maintenanceDepartentId;
    dic[@"remark"] = remark;
    dic[@"weatherCode"] = weatherCode;
    dic[@"state"] = state;
    dic[@"maintainUnitId"] =maintainUnitId ;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceRecord/SaveMaintentanceRecord" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害维修安全登记
+ (void)getDiseaseMaintainSafeSignWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceRecordId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceRecord/SecurityRegister" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 安全检查列表
+(void)safetyCheckWithPage:(NSInteger)page pageSize:(NSInteger)pageSize block:(netRequestResultBlock)finishBlock{

    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"pageSize"] = [NSString stringWithFormat:@"%ld",pageSize];
    dic[@"current"] = [NSString stringWithFormat:@"%ld",page];
    [self asyncNetworkingUrl:@"app/v1/dmSecurityCheck/QuerySecurityCheckPage" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 安全检查详情
+ (void)safetyCheckDetailWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"securityCheckId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/dmSecurityCheck/GetSecurityCheckDetail" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害验收列表
+(void)diseaseReceiveWithPage:(NSInteger)page pageSize:(NSInteger)pageSize block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"pageSize"] = [NSString stringWithFormat:@"%ld",pageSize];
    dic[@"current"] = [NSString stringWithFormat:@"%ld",page];
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceAcceptance/QueryData" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 病害验收详情
+ (void)diseaseReceiveDetailWithID:(NSString *)diseaseId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceAcceptanceId"] = diseaseId;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceAcceptance/Detail" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 安全登记
+ (void)securityRegisterWithMaintentanceRecordId:(NSString *)maintentanceRecordId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceRecordId"] = maintentanceRecordId;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceRecord/SecurityRegister" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 生成维修单
+ (void)becomeMaintentanceWithMaintentanceNoticeId:(NSString *)maintentanceNoticeId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"maintentanceNoticeId"] = maintentanceNoticeId;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceNotice/addMaintentanceRecord" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 重拟验收日期
+ (void)resetWithMaintentanceRecordId:(NSString *)maintentanceRecordId planAcceptanceDate:(NSString *)planAcceptanceDate block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"acceptanceNoticeId"] = maintentanceRecordId;
    dic[@"acceptanceDate"] = planAcceptanceDate;
    [self asyncNetworkingUrl:@"app/v1/dmAcceptanceNotice/ReconstructAcceptanceDate" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 启动验收
+ (void)becomeReceiveWithmaintentanceRecordId:(NSString *)maintentanceRecordId block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"acceptanceNoticeId"] = maintentanceRecordId;
    [self asyncNetworkingUrl:@"app/v1/dmAcceptanceNotice/StartAcceptance" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 获取桩号
+ (void)getZhuangNumWithLng:(NSString *)lng lat:(NSString *)lat block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"lng"] = lng;
    dic[@"lat"] = lat;
    [self asyncNetworkingUrl:@"app/v1/stake/stakeParam" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 个人信息
+ (void)getUserInfoblock:(netRequestResultBlock)finishBlock{
    [self asyncNetworkingUrl:@"app/v1/systemTool/GetUserMessage" andDict:nil
                 finishBlock:finishBlock];
}
#pragma -mark 联系我们
+ (void)getCallMeblock:(netRequestResultBlock)finishBlock{
    [self asyncNetworkingUrl:@"app/v1/systemTool/GetSystemSet" andDict:nil
                 finishBlock:finishBlock];
}
#pragma -mark 获取工程编码
+ (void)getProjectCodeWithSubProjectTypeCode:(NSString *)subProjectTypeCode block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"subProjectTypeCode"] = subProjectTypeCode;
    [self asyncNetworkingUrl:@"app/v1/dmMaintentanceRecord/getMaintentanceMeasure" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark 修改密码
+ (void)resetPasswordWithOldUserPwd:(NSString *)oldUserPwd userPwd:(NSString *)userPwd block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"oldUserPwd"] = oldUserPwd;
    dic[@"userPwd"] = userPwd;
    [self asyncNetworkingUrl:@"app/v1/systemTool/changePassword" andDict:dic
                 finishBlock:finishBlock];
}
#pragma -mark  公告
+ (void)getPublicDataWithPage:(NSInteger)page pageSize:(NSInteger)pageSize block:(netRequestResultBlock)finishBlock{
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithCapacity:1];
    dic[@"pageSize"] = [NSString stringWithFormat:@"%ld",pageSize];
    dic[@"current"] = [NSString stringWithFormat:@"%ld",page];
    [self asyncNetworkingUrl:@"app/v1/systemTool/GetNotic" andDict:dic
                 finishBlock:finishBlock];
}
@end
